package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import com.itheima.service.HealthItemService;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RequestMapping("/checkitem")
@RestController
public class HealthItemController {
    @Reference
    public HealthItemService healthItemService;
    @PostMapping("/findPage")
    public PageResult findPageItem(@RequestBody QueryPageBean queryPageBean){

        PageResult pageItem = healthItemService.findPageItem(queryPageBean);

        return pageItem;
    }
    @GetMapping("/findById")
    public Result findByid(@RequestParam int id){

        return healthItemService.findByid(id);
    }


    @PostMapping("/edit")
    public Result update(@RequestBody CheckItem checkItems){


        Result update = healthItemService.update(checkItems);




        return update;
    }

    @GetMapping("/findAllcheckitem")
    public Result findAllcheckitem(){
//        List<CheckItem> all = healthItemService.findAll();

        Result all = healthItemService.findAll();

        return all;
    }

}